//
//  ViewController.m
//  WeixinActivity
//
//  Created by Johnny iDay on 13-12-2.
//  Copyright (c) 2013年 Johnny iDay. All rights reserved.
//

#import "ViewController.h"
#import "ShareModel.h"
#import "ActivityModel.h"
@interface ViewController () {

}

@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];

}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)share:(id)sender
{
    ShareModel *model = [ShareModel standerInstance];//a
    model.title = @"激情大派对，就差你一个了！";
    model.image = [UIImage imageNamed:@"icon_session"];
//    SHARE(model);
    UIActivityViewController *actiCon = [[UIActivityViewController alloc] initWithActivityItems:[model itemsArr] applicationActivities:[ActivityModel activityArr]];//b
    actiCon.excludedActivityTypes = @[UIActivityTypeCopyToPasteboard ,UIActivityTypeAirDrop, UIActivityTypePrint];//c
    actiCon.completionWithItemsHandler = ^(NSString * __nullable activityType, BOOL completed, NSArray * __nullable returnedItems, NSError * __nullable activityError)//d
    {
        //TODO: 如果前面操作都正确就返回成功
        //completed显示是否打开成功
        NSLog(@"%@",completed ? @"成功" : @"失败");
    };
    [self presentViewController:actiCon animated:YES completion:nil];
}


@end
